package cn.com.cpic.insurance.rulecheck.core.operator.impl;

import org.apache.commons.lang.StringUtils;

import cn.com.cpic.insurance.rulecheck.core.operator.Operator;

public class ListNotInListOperator implements Operator {

	public boolean calculate(String leftValue, String rightValue) {
		String[] list1 = StringUtils.split(leftValue, ',');
		String[] list2 = StringUtils.split(rightValue, ';');
		for (String s : list1) {
			if (StringUtils.indexOfAny(s, list2) >= 0) {
				return false;
			}
		}
		return true;
	}

	public String getFalseMessage(String label, String value) {
		return label + "不能是 [ " + StringUtils.replace(value, ";", "、") + " ] 中之一";
	}

	public String getFormatMessage(String label) {
		return label + "必须是字符串";
	}
}
